package fun.tan90.easy.binlog.worker.job.impl;


import fun.tan90.easy.binlog.worker.job.MetricJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;


/**
 * description TODO
 * company 铁人科技
 *
 * @author 陈浩杰
 * @date 2023/10/27 10:59
 */
@Slf4j
@Component
public class JvmTotalMetricJob extends MetricJob {

    @Override
    @Scheduled(cron = "0 0/1 * * * ?")
    public void task() {
        doTask("metric_jvm", "jvm_type:total");
    }

    @Override
    protected Map<String, MetricTag> rowMap() {
        Map<String, MetricTag> rowMap = new HashMap<>();
        rowMap.put("committed", MetricTag.builder().requiredMetricName("jvm.memory.committed").build());
        rowMap.put("max", MetricTag.builder().requiredMetricName("jvm.memory.max").build());
        rowMap.put("used", MetricTag.builder().requiredMetricName("jvm.memory.used").build());
        return rowMap;
    }

}